package com.example.deptconsumer80.controller;

import com.example.api.model.Dept;
import com.example.dept.service.DeptClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;
import java.util.List;

/**
 * @ClassName: DeptConsumerController
 * @Author: liugui
 * @Date: 2020-09-19 09:56
 **/
@RestController
public class DeptConsumerController {

    @Resource
    private DeptClient deptClient;

    @RequestMapping(value = "/consumer/dept/add")
    public boolean add(Dept dept) {
        return deptClient.add(dept);
    }

    @RequestMapping(value = "/consumer/dept/get/{id}")
    public Dept get(@PathVariable("id") Long id) {
        return deptClient.get(id);
    }

    @RequestMapping(value = "/consumer/dept/list")
    public List<Dept> list() {
        return deptClient.list();
    }


}
